<?php


class Model_Products_Categoryorder extends Zend_Db_Table_Abstract {

	protected $_name = 'products_v1_category_order';
	
	public function getCategoryorder( $idCategory){
		
		$row = $this->fetchRow("`id_category` = ". $idCategory);
		if(!$row) return false;
		return $row->toArray();		
		
		}
		
	public function addCategoryorder( $titleCategory){
		
		$data = array(
			
         "title_category" =>  $titleCategory 
	
			);
		$this->insert($data);
		
		}
		
	public function updateCategoryorder(  $idCategory ,  $titleCategory){
		$data = array(
			
         "title_category" =>  $titleCategory 
	
			);
			
		$this->update($data,"`id_category` = ". $idCategory);
		}
		
	public function deleteCategoryorder( $idCategory){
		
		$this->delete("`id_category` = ". $idCategory);
		
		}	
	
	public function listAll(){
		
		$rows =$this->fetchAll("1","id_category DESC ");
		if(!$rows) return false;
		return $rows->toArray();			
		
		}
	public function listAllArray(){
		$arr = self::listAll();
		$arrRes = array();
		foreach($arr as $item){
			$arrRes[$item['id_category']] = $item['title_category'];
		}
		return $arrRes;
		
	}		
}


?>